The connection between W31, SGR 1806-20, and LBV 1806-20: Distance, extinction, and structure