Localization–delocalization transition of dipolar bosons in a four-well potential