How do you solve the issue with an object with subdivision and multiple materials on it?
I guess you have two solutions:


create 4 additional edge loops close to your first edges so that it forces your texture to stick to these edges


or


unwrap your object and use a black square as a factor in a mix shader