The total intrinsic curvature of curves in Riemannian surfaces