Heterogeneous Firms, Agglomeration and Economic Geography: Spatial Selection and Sorting