A quantitative model for the sedimentary rock cycle