A quantile-based probabilistic mean value theorem