body{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    margin: 0;
}

.box-container{
    width: 200px;
    height: 200px;
    grid-template-columns: 0.5fr 0.5fr;
    display: grid;
    position: relative;
}

.color-box{
    height: 100%;
    width: 100%;
    transition: transform 0.5s;
    z-index: 2;
}

.color-box:first-child {
    background-color: red;
    transform-origin: 0% 0%;
}

.color-box:nth-child(2) {
    background-color: yellow;
    transform-origin: 100% 0%;
}

.color-box:nth-child(3) {
    background-color: blue;
    transform-origin: 0% 100%;
}

.color-box:nth-child(4) {
    background-color: green;
    transform-origin: 100% 100%;
}

.box-container:hover > .color-box:first-child {
    transform-origin: 0% 0%;
    transform: rotate(90deg);
}

.box-container:hover > .color-box:nth-child(2) {
    transform-origin: 100% 0%;
    transform: rotate(-90deg);
}

.box-container:hover > .color-box:nth-child(3) {
    transform-origin: 0% 100%;
    transform: rotate(-90deg);
}

.box-container:hover > .color-box:nth-child(4) {
    transform-origin: 100% 100%;
    transform: rotate(90deg);
}

.text-container{
    position: absolute;
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}