Tag offset, vector and coordinate system

I have searched the forums but i couldn’t really find what i was looking for.

I wanna place tag and give them an offset (i.e. 500mm) using a script.

But when an element is rotated the tag ‘shifts’ a little. How do i prevent this?

I know the ‘problem’ is the coordinate system in combination with my rotated object.

It is probably pretty simple, but at the moment i dont see it.
Who can point me in the right direction / topic?