Spinning cube with faces always right side up

Howdy,

Im trying to solve an implementation for a spinning cube trying to replicate Goo’s HyperCube. Right now we are happy with the interactivity and physics, but we dont like the rotations. If you play with the project you’ll see that what its doing is trying to ‘snap back’ to the ortho face most in view but because of how the cube works in terms of symmetries, you eventually get an orientation where the whole cube has to rotate around to be come right side up again. Here is the project link, sorry if its hard to follow. Between my inexperience with 3D, PC being new to me, and needing to try to make it ‘production quality’, it may be a bit snakier than typical forum requests.

https://playcanv.as/p/cIrqquNt/

Heres a video sort of showing where the ‘glitch’ is we are trying to solve:
CloudApp

Thanks for any assistance. Im still trying to solve myself so even any insight into just the generals of the 3D math would be helpful since I barely understand how to work with complicated rotations and object orientations in 3D space.

Reference GooCreate’s Hyper Cube: https://schteppe.github.io/hyper-cube/

As you can see in the gif below, they ‘cheat’ by rotating the textures on the face so they will always look the right side up.

Not sure what would be the best way to go about doing this.

My first thought would be to modify the UV coords when you cross certain thresholds.

If this is just 6 planes, then you could just rotate the mesh to suit.