Rotating map and camera

so I’m currently making a isometric game, and have just gotten rotating the world to work.

This is what I use to rotate the world tiles.


    public int getDrawX(){
        double rad = Math.toRadians(Screen.rotateScreen);
        double rotX = (Math.cos(rad) * x) - (Math.sin(rad) * y);
        double rotY = (Math.sin(rad) * x) + (Math.cos(rad) * y);
        
        return (int)((rotY * WIDTH / 2) + (rotX * WIDTH / 2));
    }
    
    public int getDrawY(){
        double rad = Math.toRadians(Screen.rotateScreen);
        double rotX = Math.cos(rad)*x - Math.sin(rad)*y;
        double rotY = Math.sin(rad)*x + Math.cos(rad)*y;
        
        return (int)((rotX * HEIGHT / 2) - (rotY * HEIGHT / 2) - height);
    }

and this is what I use to rotate the screen


        if(e.getKeyCode() == KeyEvent.VK_R){
            Screen.rotateScreen = 90+Screen.rotateScreen%360; 
            
            double rad = Math.toRadians(Screen.rotateScreen);
            double newScreenX = Math.cos(rad)*Screen.offsetX - Math.sin(rad)*Screen.offsetY;
            double newScreenY = Math.sin(rad)*Screen.offsetX + Math.cos(rad)*Screen.offsetY;
            
            Screen.offsetX = (int)newScreenX;
            Screen.offsetY = (int)newScreenY;
        }

The world rotate just fine, but the screen doesn’t follow the rotation.

Seems like there is a problem with your camera.

I know. I thought the 2nd code would rotate the offset X and Y of the view/screen just fine. But It doesn’t, and I have no idea why or how to fix it.

EDIT:
What happens I look on a part of the level. OffsetX: -377 and OffsetY: 374. Then press R so the level gets rotate 90 degrees. I get offsetX: -374 offsetY: -377 and see the part of the level I was watching before.

Those lines look strange

return (int)((rotY * WIDTH / 2) + (rotX * WIDTH / 2));
return (int)((rotX * HEIGHT / 2) - (rotY * HEIGHT / 2) - height);

What is that supposed to do?
I’m guessing the key to this error is in the code you didn’t post. Maybe you rotate in the wrong direction somewhere.

Those lines is to make the tiles render isometrically. What do you mean with code I didn’t post?

Wouldn’t you want your Camera rotating the opposite way as your tiles?