Cosmology of quadratic metric-affine gravity