Fitting perception in and to cognition