It’s simple if you allow points A&D, C&F, and B&E to coincide. Then, a variation of (assuming angle BAC is not right) the Pythagorean theorem will yield [a variation of] $(EC)^2=(AF)^2+(BD)^2$. Whatever the approach, the minimum length of EC will require the segments AF, BD, and EC each to be the entire length of their respective sides.