Tensor algebras of subproduct systems and noncommutative function theory