See image:

If the lines x2/y2's distance travels more horizontally, the end walls are vertical, while if it travels more horizontally, the walls are vertical.
Is there any way to 'trick' it into drawing the walls vertically every time, so connected lines (with setlinewidth 1+) can look proper?

If the lines x2/y2's distance travels more horizontally, the end walls are vertical, while if it travels more horizontally, the walls are vertical.
Is there any way to 'trick' it into drawing the walls vertically every time, so connected lines (with setlinewidth 1+) can look proper?