Supply, Demand, Institutions, and Firms: A Theory of Labor Market Sorting and the Wage Distribution