Keep aspect ratio when replacing image in Impress?


I am building an Impress template in which users are supposed to replace the image on the title page.
The original image is cropped and scaled to fit into a certain area on the slide. I want the new image to also fit into this area.
When I replace the image, the new image is scaled to fit into the cropped area, however it ignores aspect ratio and “squeezes” the image into the box.
Instead, I want the new image to keep its aspect ratio and fit into the same area as the original image by cropping it correctly, (not by scaling it), and especially not by scaling the sides by different factors.

How can I achieve this?
If this isn’t possible, how can I instead restore the aspect ratio after replacing the image, without exceeding the original area?
I know about Right Click → Original Size, but this scales the image back up to its original size, ignores the cropping completely and then users have to manually scale and crop their image again to fit the original area.

Libre Office version