Geometry nodes and uneven Geometry (again, continued)

I’ve been using Geonodes to generate building blocks (Using instances of pre-made architecture.)as below:

enter image description here

I’m currently trying to create a node setup that will generate blocks on planes which have an angled edge, like below:

enter image description here

So far I’ve figured I can make it work by creating three separate geometries, splitting up the shape.
First I tackled the rectangle using the shortest Y edge which will take my original node set up nicely and generate a rectangular block:

enter image description here

Then I create a rectangle based on the remainder when I subtract the short Y from the long Y:

enter image description here

And then used a compare node to mask out everything but the edge I need:

enter image description here

Then I tackle the angled edge by creating another cube, taking the angle from the geometry’s edge and translating it to the cube’s rotation, then mask out so I just have the edge I need.
enter image description here
enter image description here

I’ve worked out the maths I need to make the main section and the additional edge work together on various sizes of geometry. However I’m struggling to get the angled edge to work on different sizes of geometry.
enter image description here

Can someone advise me of what I’d need to do to make the angled geometry align nicely to the other two pieces of geometry. OR advise if there is a better way to achieve what I am trying to do?

I’ve attached my blend file. Each of my instances is 6m x 6m. Currently using cubes instead of my pre-made architecture.