Make a Grid: Get all the x-coordinates from the vertical sides of your rectangles, and the start/end points x-coord. Same for y-coordinates: get all y's from horizontal sides and start/end points y-coord. Sort these x's and y's. These lines make up a grid over your area. The shortest path gonna turn only on these grid lines, right?
Find Valid Spots (Nodes): Look at every point where your grid lines cross (x, y). Is that point inside the area made by combining all your rectangles? If yes, this point is a node for a graph we're building.
Connect the Spots (Edges): Now, look at two nodes that are right next to each other on the grid (directly left/right or up/down). Draw a line segment between them. Is this entire line segment also inside your combined rectangle area? If yes, add an edge between these two nodes in your graph. The 'weight' or cost of this edge is just the distance between the points (like abs(x1-x2) + abs(y1-y2) cause its orthogonal).
Add Start/End: Make sure your start and end points are nodes too. You gotta connect them to the grid graph. Find the grid nodes they can reach with a straight horizontal or vertical line without leaving the rectangle area, and add edges for those connections.
Find Path: Now you got a graph. Just use a standard algorithm like Dijkstra's or A* search to find the path with the lowest total edge weight from your start node to your end node. [3]