Oh, and you need to do the rotations in this order :-
z,x,y
z,x,y
;rotate offset around Z axis newx# = x# * Cos#(zr#) - y# * Sin#(zr#) newy# = x# * Sin#(zr#) + y# * Cos#(zr#) x# = newx# y# = newy# ;rotate offset around X axis newy# = y# * Cos#(xr#) - z# * Sin#(xr#) newz# = y# * Sin#(xr#) + z# * Cos#(xr#) y# = newy# z# = newz# ;rotate offset around Y axis newx# = z# * Sin#(-yr#) + x# * Cos#(-yr#) newz# = z# * Cos#(-yr#) - x# * Sin#(-yr#) x# = newx# z# = newz#