How to rotate a node in a plugin and have the x and y position update automatically

When I rotate an object in Figma, i.e., set the rotation to X degrees, the X and Y position of the object update.

When I rotate an object in a plugin, by setting its rotation to a set value, the position values remain unchanged. Is there a way to rotate an object inside of a plugin, such that the position of that node is automatically updated like it is in the UI?