JSFiddle - React, Tailwind, and code Playground

HTML

<div class="wrap">
    <div class="cube">
        <div class="cube-side front">front</div>
        <div class="cube-side back">back</div>
        <div class="cube-side left">left</div>
        <div class="cube-side right">right</div>
    </div>
</div>

CSS

.wrap {
    perspective: 800px;
    perspective-origin: 50% 100px;
}
.cube {
    position: relative;
    width: 200px;
    transform-style: preserve-3d;
}
.cube div {
    position: absolute;
    width: 200px;
    height: 200px;
}
.back {
    transform: translateZ(-100px) rotateY(180deg);
    background: red;
}
.right {
    transform: rotateY(-270deg) translateX(100px);
    transform-origin: top right;
    background: green;
}
.left {
    transform: rotateY(270deg) translateX(-100px);
    transform-origin: center left;
    background: yellow;
}
.top {
    transform: rotateX(-90deg) translateY(-100px);
    transform-origin: top center;
    background: purple;
}
.bottom {
    transform: rotateX(90deg) translateY(100px);
    transform-origin: bottom center;
        background: blue;
}
.front {
    transform: translateZ(100px);
        background: pink;
}
@keyframes spin {
    from {
        transform: rotateY(0);
    }
    to {
        transform: rotateY(360deg);
    }
}
.cube {
    animation: spin 5s infinite linear;
}
.cube-side{
    border-radius: 40px;
}