fixed minimum rectangle algorithm