How to transform screen coordinates in viewpoirt coordinates?

Hi, someone knows to make that? I have a camera with one sdl rect (the viewport), the screen coordinates it’s not the same as the viewport and I’ve tried to convert with: mouseX = event.button.x * (viewportWidth/screenWidth). But witohout sucess, because I think that SDL reconvert the mouseX in the draw functions.

Can anyone help me? I dont’ know anymore what to do.

Wow man, after many tries I did! Oh Yeah I did it! hahaha
If you need the same make this:
example: if you want to convert screen coordinates to viewport coordinates and your viewport is in (0,0) just make: float pixelX = viewport.width / screen.width, make the same with axis Y, so get the pixel width, so make posX = posX * pixelX to get the coordinates in viewport for the X axis. But if you need to get the relatives posX of mouse to the cemara, just make: mouseX = moseX * pixelX + camera.posX, camera.posX is in coordinates of the world, (or the viewport in this case)