Tridiagonalization and the Heun equation