Electronic and Band Structure Tuning of Ternary Semiconductor Photocatalysts by Self Doping: The Case of BiOI