Need help/hint on mouse position with rotated objects

Hello, I’m trying to make a visualization of tracks in my spotify playlists. The goal I’m trying to reach is doing a sort of radial column chart with the 100 songs of my playlists, with lengths based on track duration. In addition, i would like to have information displayed when i press on a particular column corresponding to that track. Here is my problem, I dont understand if it’s possible or how to relate the mouse position and the rotation.

The following code results in what i try to visualize:

pushMatrix();
translate(500, height/2);
for (int i = 0; i < tracks_2017.size(); i++){
rotate(radians(3.6));
rect(0, -150, 10, -tracks_2017.get(i).duration/1400);
}
popMatrix();

And this is the result: https://i.imgur.com/XN7Bxqe.png

if (mouseX > 500 && mouseX < 510 && mouseY < height/2 -150 && mouseY > height/2 - tracks_2017.get(i).duration/1400 && mousePressed == true)

This is what I use usually to check position on not rotated items, and don’t know how to relate it with rotations. Thanks for the eventual replies.