Seamless teleportation with rotation - Minecraft 1.14

I am trying to figure out how to seamlessly teleport the player while also rotating them, the problem is when just doing

execute as @a[x=-153,y=29,dy=2,z=-84] at @s rotated as @s run tp @s ~-37 ~10 ~1 ~180 ~

the x position won't be correct because it isn't being mirrored. The problem is that I don't know how to do that. I think it would be using score operations, but then I don't know the maths for it.

Consider the picture below:
If the player is up against the blue stained glass (the starting position) they are at x -151.3, and if they are up against the lime stained glass (the destination), x is -190.7.
I would need to reflect over the red stained glass (the center line) to make teleporting the player 180° with relative coordinates seamless. How would I go about doing that? (If I get what I need for the x axis, I should be able to apply it to the z axis myself).

Antichamber Many Paths To Nowhere Stairs in Minecraft from above with stained glass markers


You can't really do scoreboard things with the coordinates of a /tp command. What you can do is setting the Pos tag of a dummy entity and then teleporting the player to it. So you can for example summon an armour stand at the player's position:

/execute at @p run summon armor_stand

…and then get its position into a scoreboard:

/execute store result score @p x run data get entity @e[type=armor_stand,limit=1] Pos[0]

(after preparing the scoreboard of course, the same for Y and Z).
Then you can assign the sum of the starting X coordinate and the target X coordinate to some dummy entity or fake player or whatever and use /scoreboard players operation to subtract the starting coordinates from it. The same for Z of course.
Finally, you set the coordinates of the armour stand to the target coordinates:

/execute store entity @e[type=armor_stand,limit=1] Pos[0] run scoreboard players get @p x

And then you simply teleport the player to the armour stand. If the target coordinates are far away, you have to do it in the same tick, because the chunk will unload again otherwise.
And of course you'll likely want to restrict these target selectors @p and @e[type=armor_stand] somewhat, depending on the rest of your setup.