execute store result score @e[name=corner,limit=1] x run data get entity @e[name=corner,limit=1] Pos[0]
execute store result score @p x run data get entity @p Pos[0]
execute store result score @e[tag=currentcorner,limit=1] x run data get entity @e[tag=currentcorner,limit=1] Pos[0]
execute store result score game x_difference run scoreboard players operation @p x -= @e[name=corner,limit=1] x
execute if score game dimension matches 0 store result entity @e[name=marker,limit=1] Pos[0] double 1 run scoreboard players operation @e[tag=currentcorner,limit=1] x += game x_difference
execute if score game dimension matches 1 store result entity @e[name=marker,limit=1] Pos[1] double 16 run scoreboard players get game x_difference