Use the right and left arrow keys to turn the "cube." The structure will automatically go back to the nearest diagonal should you stop moving it.
This was made in the 3D modelling software Blender. Blender is free and compatible with Mac, Windows and Linux.