J-inner matrix functions, interpolation and inverse problems for canonical systems, I: Foundations