def canonical_order(*corners):
    """return corners of enclosing rectangle in their canonical order 
    (clockwise starting from bottom left).
    can be used to simply reorder rectangle nodes."""
    xmin = min(x[0] for x in corners)
    xmax = max(x[0] for x in corners)
    ymin = min(x[1] for x in corners)
    ymax = max(x[1] for x in corners)
    return (xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)