I have following code, where closely mapped sprite, rectangle and polygon is been rotated at same angle in libgdx. After rotation rectangle is misaligned with the sprite. Although sprite is rotated when its drawn, the coordinates and dimensions stay same after the rotation. This is not the case for rectangle. Please see the code and results image below.
public void rotate(int angle){
System.out.println("Before-recta x , y " + this.rectangle.getX() + " " + this.rectangle.getY() + " " + this.rectangle.getHeight() + " " + this.rectangle.getWidth());
System.out.println("Before-sprite x , y " + sprite.getX() + " " + sprite.getY()+ " " + this.sprite.getHeight() + " " + this.sprite.getWidth());
this.sprite.rotate(angle);
this.rectangle = null;
this.polygon.rotate(angle);
this.rectangle = this.polygon.getBoundingRectangle();
System.out.println("Afer-sprite x , y " + sprite.getX() + " " + sprite.getY() + " " + this.sprite.getHeight() + " " + this.sprite.getWidth());
System.out.println("Afer-recta x , y " + this.rectangle.getX() + " " + this.rectangle.getY() + " " + this.rectangle.getHeight() + " " + this.rectangle.getWidth());
}