Wrench attaching to bolt and being screwed around it by following motion controller?

Basically what I’m after is like a slightly simpler version of what was done in the game Wrench:
I think I’ve kind of figured out the underlying structure of what I want to achieve, but I can’t figure out the math part.

This is what I’ve got so far:

The “MC Initial Transf” is the transform of the Motion Controller, set when the wrench attaches to the bolt. The logic behind this is to multiply the Right Vector with both the starting location and the current location of the Motion Controller, then add the difference together and add it to the starting rotation of the Motion Controller.
Although ideally I would like the Right Vector to update so that you can move the controller in a circle around the bolt to screw it in.

What’s happening now is that it works perfectly fine, but only if you move the motion controller within about a 90 degree angle. It also seems to have issues when going from a positive rotation value into the negatives.

Any ideas? Would really appreciate any kind of help here.