.cube {
  position: relative;
  width: 120px;
  height: 120px;
  transform-style: preserve-3d;

  animation: animate 20s linear infinite;
}

@keyframes animate {
  0% {
    transform: rotateX(-30deg) rotateY(0deg);
  }

  100% {
    transform: rotateX(-30deg) rotateY(360deg);
  }
}

.cube div {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.cube div span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(#151515, #00ec00);
  transform: rotateY(calc(90deg * var(--i))) translateZ(60px);
}

.cube div span img {
  width: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  height: 100%;
}

.top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #222;
  transform: rotateX(90deg) translateZ(60px);

  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;

  color: white;
}

.cube div span {
  display: flex;
  justify-content: center;
  align-items: center;

  color: white;
  font-size: 20px;
}