Material apply multiple RotateAboutAxis and then BoxMask? Am I getting the logic wrong?

I am trying to make an application where you can paint onto a material where a cube (or other shape) intersects it, Like in these examples where it is working for me:

. However, when I rotate it about more than one axis at a time, it sometimes starts distorting like so:


Here is the cube blueprint that sets the vector parameters:

And here is the material that should change texture where it intersects the cube:

. I am almost certain that the error is in the material blueprint and has something to do with the rotation logic.
Any ideas?
Thank you!