Well-posedness of general 1d initial boundary value problems for scalar balance laws