You could model your operations as $$ \DeclareMathOperator{vsplit}{vsplit} \DeclareMathOperator{hsplit}{hsplit} \vsplit((x, y, w, h)) = ((x-w/4, y, w/2, h), (x + w/4, y, w/2, h)) \\\ \hsplit((x, y, w, h)) = ((x, y-h/4, w, h/2), (x, y+h/4, w, h/2)) $$ These functions take a rectangle, described as four tupel $(x,y,w,h)$ where $(x,y)$ are the coordinates of its midpoint, and return the rectangle tuples for the two children.