Dimension Reduction for Heterogeneous Populations of Oscillators