How can I draw a TexturedRegion in a CanvasItem rotate?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By juanpaexpedite

Let’s take this example:

https://imgur.com/a/36VrBUe

UPDATE 1:
I have seen that I have to make the posrectangle to (0,0):
posrectangle = new Rect2(0,0, sprite.Size.Width * scale.x, sprite.Size.Height * scale.y);
and then transform the origin, now it is rotating better.
Now I have to find the details to make it work perfect.

Where I set the relative center rotation about (0.5f,0.95f)

This is what I would like to set by code:

float rot = rotationdegrees * degTorad;
Transform2D t = Transform2D.Identity;
t.x.x = t.y.y = Mathf.Cos(rot);
t.x.y = t.y.x = Mathf.Sin(rot);
t.y.x *= -1;

//Do not know how to set this origin:
t.origin = new Vector2(0.5f,0.95f);
//or
t.origin = new Vector2(pixelsoriginx, pixelsoriginy);

spritebatch.DrawSetTransformMatrix(t);
spritebatch.DrawTextureRectRegion(texture, posrectangle, sourcerectangle, modulate:color);

Where spritebatch is an standard CanvasItem.

How can I make that?, because the rotations are made from (0,0) of the CanvasItem.
What is the equivalent of the image to code?

Thank you!