Calculate bounding boxes