Ecological filtering shapes the impacts of agricultural deforestation on biodiversity.