Something I was very proud of doing EARLY was making a robust coordinate transform API for doing all the various relevant operations in the game.
The map renders to a camera viewport which is shown inside a ui framework all inside "ega space" which also vertically stretches and this final framebuffer renders inside an #imgui window. Many layers!
The fruits of this are that if I want to, say, use imgui draw lists overlaid over in-game logical concepts, it's trivial!! Here I was able to rapidly display a grid in imgui-space based on the ega-space camera position