Is there a strait forward way to force a mask to be aligned vertically / horizontally?

see

change the line

as

thresh = cv.threshold(gray, 0, 255, cv.THRESH_BINARY | cv.THRESH_OTSU)[1]

result
Rotated