JSFiddle - React, Tailwind, and code Playground
HTML
<div class="dice">1</div>
<div class="dice" id="rotated" onclick="this.style.transform = 'rotate('+ (1*-90) +'deg)';">2</div>
CSS
.dice {
margin: 4.5px auto;
width: 40px;
height: 34px;
border: 1px solid black;
border-radius: 9px;
background-color: ghostwhite;
transition: 900ms ease all;
text-align: center;
line-height: 10px;
padding-top: 5px;
}