I see.
Then what you must do is to map the position and size (of the selection) from main view to overlay view. Probably with something like:
window.mapPixelToCoords(window.mapCoordsToPixel(position, mainView), overlayView);
Do this both for the top-left corner the bottom-right corner and you get the coordinates of your rectangle in proper overlay coordinates.
I am doing like this
setView(mainView)
sprite.draw(*this);
selection.draw(*this);
setView(overlayView);
sf::Vector2f position = selection.getPosition();
sf::Vector2f scale = selection.getScale();
mapPixelToCoords( mapCoordsToPixel( position, mainView), overlayView);
mapPixelToCoords( mapCoordsToPixel( scale, mainView), overlayView);
It is not mapping the pixel. I am getting the same result like image 2.
Thanks for reply.