Predicting Adaptation and Maladaptation of Populations to a Changing Climate