## Mathematica, 178 bytes ##

    (n=Characters/@{#2,#3,#4};Function[b,x=n[[1]]/.Table[ToString@i->2+(b~IntegerDigits~2~PadLeft~8)[[1+i]],{i,0,7}]/._String->1;StringJoin@@Table[n[[x[[i]],i]],{i,Length[x]}]]/@#1)&