Population dynamics in a changing world: the consequences of environmental variation for species with complex life histories