Theory of excitonic confinement in semiconductor quantum wires