Ahh a Rubik’s cube, depending on the axis of rotation and the changed position of the a single cube then the cube’s pivot or parent will need to change. Tricky.
Search the forum for Rubik and check out the various suggestions as other have had a go at building a Rubik’s cube.
I simplified the example by using a 2x2x2 cube. Somehow it seems as if the parts of the rubiks cube are rotated an additional time. I don’t know what is causing this behaviour