Classical digraph substitution cipher. Educational use only.
Input
Rules (encode): split into digraphs; if a pair has same letters, insert pad after first; if odd length, pad the last. Same row: shift right. Same column: shift down. Rectangle: swap columns.