TRACE: A Differentiable Approach to Line-Level Stroke Recovery for Offline Handwritten Text