Utility functions for calculating min and max for rect structs