'SDL2, how predict rect coordinates after rotation?

My goal - move sprite, left and right arrows keys must set directions of moving.I struggle with rotation geometry few days, and it beat me. My code below

void rotate_point(float cx, float cy, float angle, int *px,int *py) {
    *px = cos(angle) * (*px - cx) - sin(angle) * (*py - cy) + cx;
    *py = sin(angle) * (*px - cx) + cos(angle) * (*py - cy) + cy;
}

https://pastebin.com/vUvnNkKb

How you can see, moves of red line on rotations mismatched with X,Y of sprite rect.Many thanks to everyone who can helps.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source