minimum area rectangle algorithm