Thanks a bunch to @Scratch-Minion for the original project. This really helped me! Sorry about butchering your code ;) I just wanted to get it working. Almost all the code is by @Scratch-Minion, "Initialize Tetrahedron" is mine and I made some modifications elsewhere to make it work.
Original instructions: Rotate the cube around the X and Y axes using the mouse. To best see how the rotation works, move the mouse backwards and forwards or up and down through the centre of the screen. The changes to the code are small.